package com.stefan.sort;

import java.util.Arrays;

public class B {
    public static void main(String[] args) {
        int[] data = {7,9,3,2,4,6,0,5,1,8};
        for (int i =0;i<data.length-1;i++) {
            boolean flag = false; // 还需要比较吗？ flag
            for (int j=0;j<data.length-i-1;j++) {
                if (data[j] > data[j+1]) {
                    int temp = data[j];
                    data[j] = data[j+1];
                    data[j+1] = temp;
                    flag = true;
                }
            }
            if (!flag) break;
            System.out.println(i+"伦"+Arrays.toString(data));
        }
        System.out.println(Arrays.toString(data));
    }
}
